/* 
登录相关接口的请求函数
内部调用axios二次封装的request发送ajax请求
函数的返回值为promise
*/

import request from '@/utils/request'
import type { loginResponseModel,UserInfoResponseModel } from './model/loginModel.ts'


// 使用枚举来包含所有的path
enum Api{
    Login = '/admin/acl/index/login',
    GetUserInfo = '/admin/acl/index/info',
    Logout = '/admin/acl/index/logout'
}

// 登录
export const loginApi = (username:string,password:string)=>{
    return request.post<any,loginResponseModel>(Api.Login,{username,password})
}

// 获取用户信息
export const getUserInfoApi=()=>{
    return request.get<any,UserInfoResponseModel>(Api.GetUserInfo)
}


// 退出登录
export const logoutApi=()=>{
    return request.post<any,any>(Api.Logout)
}